#pragma once

#include "form/IForm.h"
#include "Window.h"

class Form: public Window<IForm>
{
public:
	BEGIN_DEFINE_CLASS(CLSID_Form)
		DEFINE_INTERFACE_ENTRY(IForm)
		USE_INTERFACE_ENTRY(Window)
	END_DEFINE_CLASS()

	Form();
	virtual ~Form();

	event_implement(CloseEventHandler,Closed);
	event_implement(ShowEventHandler,Showed);
	event_implement(PacketExchangeEventHandler,PacketExchanged);

public:
	virtual void ExchangePacket(Packet& packet);
	virtual bool Show(showAction action);
	virtual void Close();
	virtual bool ShowModal();
	virtual bool ShowModalLoop(Packet& sentPacket);
	virtual void Setwindow(uintptr window);
	virtual uintptr Getwindow() const;

	void Reset();

private:
	Packet m_frompacket;
	uintptr m_window;
};
AUTO_REGISTER_CLASSMAP_ENTRY(Form)
